package com.socket.nio.nio.sticky.delimiterbased;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author Hexudong
 * @date 2025/5/5
 */
public class DelimiterClientHandler extends SimpleChannelInboundHandler<String> {
  @Override
  protected void channelRead0(ChannelHandlerContext ctx, String msg) {
    // 收到的消息已经自动去除了分隔符
    System.out.println("Client received: " + msg);

  }
  @Override
  public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
    System.out.println("异常" + cause.getMessage());
    ctx.close();
  }
}
